﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hfm.Common.Entity.Item;
using Hfm.Core.DataAccess.ItemData;
using Hfm.Common.Constants.Item;

namespace Hfm.Core.BusinessManager.Item
{
    public class ItemManager
    {
        protected readonly ItemData ItemDataAccess;

        public ItemManager()
        {

        }

        public ItemManager(ItemData itemData)
        {
            ItemDataAccess = itemData;
        }

        public virtual List<ItemEntity> GetItemList()
        {
            return ItemDataAccess.GetItemList();
        }

        public virtual IList<NewItemEntity> GetAllItemes(string Name, string Code, string PartNumber, string Model, int Type = 0, int? skip = null, int? take = null)
        {
            return ItemDataAccess.GetAllItemes(Name,Code,PartNumber,Model,Type,skip,take);
        }

        public virtual int SelectIsExitesCode(string Code, int Id)
        {
            return ItemDataAccess.SelectIsExitesCode(Code, Id);
        }

        public virtual int GetItemlist(string Name, string Code, string Number, string Model, int Type = 0)
        {
            return ItemDataAccess.GetItemlist(Name, Code, Number, Model, Type);
        }

        public virtual ItemEntity GetItemById(int Id)
        {
            return ItemDataAccess.GetItemById(Id);
        }

        public virtual void AddItem(ItemEntity item)
        {
            ItemDataAccess.AddItem(item);
        }

        public virtual void UpdateItem(ItemEntity item)
        {
            ItemDataAccess.UpdateItem(item);
        }

        public virtual void DeleteItem(int Id)
        {
            ItemDataAccess.DeleteItem(Id);
        }
    }
}
